package com.rsy.product.config;




import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

@Configuration
public class MyRedisConfig {


/*@Bean(destroyMethod="shutdown")
    public RedissonClient redisson() throws IOException {
        Config config = new Config();
        config.setTransportMode(TransportMode.EPOLL);
        config.useClusterServers()
                //可以用"rediss://"来启用SSL连接
                .addNodeAddress("")
                .setPassword("190909");
        RedissonClient redisson =  Redisson.create(config);
        return redisson;
    }*/

    @Bean(destroyMethod="shutdown")
    public RedissonClient redissonClient() throws IOException {
        Config config = new Config();
        //集群服务
        /*config.useClusterServers()
                .addNodeAddress("redis://114.116.84.37:6379").setPassword("190909");*/
        //单服务
        config.useSingleServer().setAddress("redis://114.116.84.37:6379").setPassword("190909");


        return Redisson.create(config);
    }


}

